﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DreamIn.Structures.ServerDatabase.Entities;
using DreamIn.Structures.ServerDatabase.BusinessLogic;
namespace DreamIn.Structures.Utils
{
    class Account
    {
        public static bool Register(String username, String password, String country)
        {
            UserBL userBL = new UserBL();
			if(existUsername(username)) { return false;} 
			
            userBL.AddUser(username, password, country);
			return true;
			
			
			
			
        }
        public static bool Login(String username,String password)
        {
            UserBL userBL = new UserBL();
             UserEntity user=userBL.GetUser(username);
             if (user == null) return false;
             if (password == user.password) return true;
             return false;
            
        }
		private static bool existUsername(String username)
		{
			UserBL userBL = new UserBL();
			if(userBL.GetUser(username)==null) return false;
			return true;
		}
    }
    
}
